#ifndef SHAPE_H
#define SHAPE_H

#include <QGraphicsItem>
#include <QtCore>
#include <QtGui>

enum Position
{
    TOP_LEFT,
    TOP_RIGHT,
    BOTTOM_LEFT,
    BOTTOM_RIGTH
};

enum LayerType
{
    NTUB,
    DIFF,
    PPLUS,
    NPLUS,
    CONT,
    P1,
    METAL1,
    METAL2,
    METAL3,
    METAL4
};

class Shape : public QObject, public QGraphicsItem
{
    Q_OBJECT
public:
    LayerType type;

    explicit Shape(QGraphicsItem *parent = 0);
    explicit Shape(LayerType);

    QRectF boundingRect() const;
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
    void resetZValue();
    void setMyScale(qreal scale);
private:
    int width;
    int height;
    bool clicked;
    bool resize;
    Position position;
    int grid;
    qreal scale;
    bool created;
protected:
    void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
    void mousePressEvent(QGraphicsSceneMouseEvent *event);
    void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
    void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
    void adjustPositionToTheGrid();
    void init();
signals:
    
public slots:

};

#endif // SHAPE_H
